package demo.jms;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

import org.springframework.stereotype.Component;

@Component("jmsListener")
public class JMSListener implements MessageListener {
	public void onMessage(Message msg) {
		if(msg instanceof TextMessage) {
			try {
				System.out.println("Message: " + ((TextMessage) msg).getText());
			} catch (JMSException e) {
				e.printStackTrace();
			}
		}
	}
}
